/**
 *
 * 数据统计
 * https://www.showdoc.com.cn/1969596173167084/8935799718202144
 *
 */

import { commonPromise } from '../index.js'

// 跨域代理前缀
// const API_PROXY_PREFIX = '/api'
const API_PROXY_PREFIX = ''
const BASE_URL = process.env.NODE_ENV === 'production' ? process.env.VUE_APP_API_BASE_URL : API_PROXY_PREFIX
// const BASE_URL = process.env.VUE_APP_API_BASE_URL

const dataBoardApi = {
  // 首页
  selectAllWithLeft: (params) => commonPromise({ params, url: `${BASE_URL}/sys/v1/user/employee/org/selectAllWithLeft`, method: 'get' }), // 部门查询员工
  selectLastMonth: (params) => commonPromise({ params, url: `${BASE_URL}/sys/v1/user/employee/org/selectLastMonth`, method: 'get' }), // 首页获取员工
  employeeRanking: (data) => commonPromise({ data, url: `${BASE_URL}/report/home/sales/data/employeeRanking`, method: 'post' }), // 员工排行榜(不包未提交订单，关闭订单)
  oneYear: (data) => commonPromise({ data, url: `${BASE_URL}/report/home/sales/data/oneYear`, method: 'post' }), // 近一年员工业绩(包括关闭订单)
  employeeOneYearExport: (data) => commonPromise({ data, url: `${BASE_URL}/report/home/employeeOneYearExport`, method: 'post' }), // 近一年员工业绩导出
  statistics: (data) => commonPromise({ data, url: `${BASE_URL}/report/home/sales/data/statistics`, method: 'post' }), // 首页销售数据统计
  variation: (data) => commonPromise({ data, url: `${BASE_URL}/report/home/sales/data/variation`, method: 'post' }), // 销售总额XX天变化趋势
  employeeRankingExport: (data) => commonPromise({ data, url: `${BASE_URL}/report/home/employeeRankingExport`, method: 'post' }), // 员工排行榜导出
  selectEmployeeKpi: (data) => commonPromise({ data, url: `${BASE_URL}/report/home/selectEmployeeKpi`, method: 'post' }), // 员工业绩统计(XX年XX月)
  selectEmployeeKpiExport: (data) => commonPromise({ data, url: `${BASE_URL}/report/home/selectEmployeeKpiExport`, method: 'post' }), // 员工业绩统计(XX年XX月)导出

  // 订单
  placeOrderMoneyDist: (data) => commonPromise({ data, url: `${BASE_URL}/report/order/report/data/placeOrderMoneyDist`, method: 'post' }), // 下单金额分布占比
  statisticsOrde: (data) => commonPromise({ data, url: `${BASE_URL}/report/order/report/data/statistics`, method: 'post' }), // 订单销售数据统计

  // 客户
  statisticsCustomer: (data) => commonPromise({ data, url: `${BASE_URL}/report/customer/data/statistics`, method: 'post' }), // 客户基础数据统计
  amountStatisticsCustomer: (data) => commonPromise({ data, url: `${BASE_URL}/report/customer/order/amount/statistics`, method: 'post' }), // 新老客户购买金额对比
  countStatisticsCustomer: (data) => commonPromise({ data, url: `${BASE_URL}/report/customer/order/count/statistics`, method: 'post' }), // 客户购买频次分布
  oldStatisticsCustomer: (data) => commonPromise({ data, url: `${BASE_URL}/report/customer/order/old/statistics`, method: 'post' }), // 新老客户人数对比
  platformStatisticsCustomer: (data) => commonPromise({ data, url: `${BASE_URL}/report/customer/platform/statistics`, method: 'post' }), // 各平台客户来源占比
  countStatisticsExportCustomer: (data) => commonPromise({ data, url: `${BASE_URL}/report/customer/order/count/statistics/export`, method: 'post' }), // 客户购买频次分布导出
  oldStatisticsExportCustomer: (data) => commonPromise({ data, url: `${BASE_URL}/report/customer/order/old/statistics/export`, method: 'post' }), // 新老客户对比导出
  platformStatisticsExportCustomer: (data) => commonPromise({ data, url: `${BASE_URL}/report/customer/platform/statistics/export`, method: 'post' }), // 各平台客户来源占比导出

  // 商品
  dataGoodsCategory: (data) => commonPromise({ data, url: `${BASE_URL}/report/goods/category/statistics`, method: 'post' }), // 各类目的销售情况
  dataGoodsCountOrder: (data) => commonPromise({ data, url: `${BASE_URL}/report/goods/count/order/statistics`, method: 'post' }), // 商品销量订单 Top10
  dataGoodsCountOrderExport: (data) => commonPromise({ data, url: `${BASE_URL}/report/goods/count/order/statistics/export`, method: 'post' }), // 商品销量订单 Top10导出
  dataGoodsCount: (data) => commonPromise({ data, url: `${BASE_URL}/report/goods/count/statistics`, method: 'post' }), // 商品销售量 Top10
  dataGoodsCountExport: (data) => commonPromise({ data, url: `${BASE_URL}/report/goods/count/statistics/export`, method: 'post' }), // 商品销量 Top10导出
  dataGoodsRefund: (data) => commonPromise({ data, url: `${BASE_URL}/report/goods/refund/statistics`, method: 'post' }), // 各商品订单取消、退货退款概况
  dataGoodsCategoryExport: (data) => commonPromise({ data, url: `${BASE_URL}/report/goods/category/statistics/export`, method: 'post' }), // 各类目的销售情况导出
  dataGoodsRefundExport: (data) => commonPromise({ data, url: `${BASE_URL}/report/goods/refund/statistics/export`, method: 'post' }), // 各商品订单取消、退货退款概况导出

  // 物流
  dataLogisticsReport: (data) => commonPromise({ data, url: `${BASE_URL}/report/logistics/report/data/statistics`, method: 'post' }) // 物流销售数据统计
}

export default dataBoardApi
